package com.chuqiyun.authorization.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Map;

/**
 * 商品(Commodity)表实体类
 *
 * @author mryunqi
 * @since 2023-04-19 17:06:56
 */
@EqualsAndHashCode(callSuper = true)
@TableName(value = "Commodity",autoResultMap = true)
@Data
public class Commodity extends Model<Commodity> {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    //商品名
    private String name;
    //描述
    private String description;
    //价钱（天）
    private String price;
    //付费周期
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, Integer> paymentCycle;
    //授权范围
    private String scopeOfAuthorization;
    //是否支持离线（0否，1是）
    private Integer offline;
    //是否隐藏
    private Integer hide;


    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.id;
    }
    }

